package com.unicloud.medical.oss.client;

import com.unicloud.medical.oss.client.properties.OSSClientProperties;
import com.unicloud.medical.oss.common.model.BucketInfo;
import com.unicloud.medical.oss.common.model.DownloadObject;
import com.unicloud.medical.oss.common.model.ObjectInfo;
import com.unicloud.medical.oss.common.model.request.*;
import com.unicloud.medical.oss.core.OSSServiceFinder;
import com.unisound.medical.common.model.dto.ResultDTO;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class LocalOSSClient extends BaseOSSClient {

    public LocalOSSClient(OSSClientProperties ossClientProperties, OSSServiceFinder ossServiceFinder) {
        super(ossClientProperties, ossServiceFinder);
    }

    /**
     * 查看存储桶是否存在
     */
    @Override
    public ResultDTO<Boolean> doBucketExist(BucketExistRequest request) {
        return execBucketExist(request);
    }

    /**
     * 创建存储桶
     */
    @Override
    public ResultDTO<Boolean> doCreateBucket(CreateBucketRequest request) {
        return execCreateBucket(request);
    }

    /**
     * 创建默认权限存储桶(默认策略支持浏览器直接访问url)
     */
    @Override
    public ResultDTO<Boolean> doCreateDefaultPolicyBucket(CreateBucketRequest request) {
        return execCreateDefaultPolicyBucket(request);
    }

    /**
     * 删除存储桶
     */
    @Override
    public ResultDTO<Boolean> doRemoveBucket(DeleteBucketRequest request) {
        return execRemoveBucket(request);
    }

    /**
     * 获取全部存储桶
     */
    @Override
    public ResultDTO<List<BucketInfo>> doGetAllBuckets(CommonRequest request) {
        return execGetAllBuckets(request);
    }

    /**
     * 获取当前存储桶所有文件
     */
    @Override
    public ResultDTO<List<ObjectInfo>> doListAllObjectsCurrBucket(ListAllObjectsCurrBucketRequest request) {
        return execListAllObjectsCurrBucket(request);
    }

    /**
     * 获取当前存储桶当前文件夹所有文件
     */
    @Override
    public ResultDTO<List<ObjectInfo>> doListObjectsCurrBucketAndFolder(ListAllObjectsCurrBucketAndFolderRequest request) {
        return execListObjectsCurrBucketAndFolder(request);
    }

    /**
     * 文件上传
     */
    @Override
    public ResultDTO<List<String>> doUploadObjects(InnerUploadObjectsRequest request) {
        return execUploadObjects(request);
    }

    /**
     * 文件上传
     */
    @Override
    public ResultDTO<String> doUploadObject(InnerUploadObjectRequest request) {
        return execUploadObject(request);
    }

    /**
     * 本地文件上传
     */
    @Override
    public ResultDTO<String> doUploadLocalObject(UploadLocalObjectRequest request) {
        return execUploadLocalObject(request);
    }

    /**
     * 批量本地文件上传
     */
    @Override
    public ResultDTO<List<String>> doUploadLocalObjects(UploadLocalObjectsRequest request) {
        return execUploadLocalObjects(request);
    }

    /**
     * 文件下载
     */
    @Override
    public ResultDTO<DownloadObject> doDownloadObject(DownloadObjectRequest request) {
        return execDownloadObject(request);
    }

    /**
     * 下载文件夹下所有文件
     */
    @Override
    public ResultDTO<DownloadObject> doDownloadObjects(DownloadObjectsRequest request) {
        return execDownloadObjects(request);
    }

    /**
     * 根据url地址删除文件
     */
    @Override
    public ResultDTO<String> doRemoveObject(RemoveObjectRequest request) {
        return execRemoveObject(request);
    }

    /**
     * 根据url地址列表批量删除文件
     */
    @Override
    public ResultDTO<List<String>> doRemoveObjects(RemoveObjectsRequest request) {
        return execRemoveObjects(request);
    }

    /**
     * 删除当前桶当前文件夹所有文件
     */
    @Override
    public ResultDTO<List<String>> doRemoveObjects(RemoveObjectsCurrBucketAndFolderRequest request) {
        return execRemoveObjectsCurrBucketAndFolder(request);
    }

    /**
     * 文件复制
     */
    @Override
    public ResultDTO<String> doCopyObject(CopyObjectRequest request) {
        return execCopyObject(request);
    }

    /**
     * 已签名地址
     */
    @Override
    public ResultDTO<String> doSignedUrl(SignedUrlRequest request) {
        return execSignedUrl(request);
    }

    /**
     * 批量已签名地址
     */
    @Override
    public ResultDTO<List<String>> doSignedUrls(SignedUrlsRequest request) {
        return execSignedUrls(request);
    }

}
